<template>
    <div>
        <p>账号: <input type="text" v-model="username"></p>
        <p>密码: <input type="password" v-model="password"></p>
        <p><button @click="login_story">登录</button></p>
    </div>
</template>

<script>
    export default {
        name: "login_story",
        data() {
            return {
                username: '',
                password: '',
            }
        },
        methods: {
            login_story(){
                this.$axios({
                    url: 'story/user/',
                    method: 'POST',
                    data: {
                        username: this.username,
                        password: this.password
                    }
                }).then(resp=>{
                    alert(resp.data.msg);
                    if (resp.data.code==200){
                        sessionStorage.setItem('user', JSON.stringify(resp.data.user));
                        this.$router.push('/index_story')
                    }
                })
            }
        },
        computed: {},
        filters: {},
        watch: {},
    }
</script>

<style scoped>

</style>
